%% Transformix transform_params;

function params = generate_tranformix_parameters_mask_toolbox(patient, scan_folder);
    %------------------------------------------------------------------------
    %   This file is part of the
    %   5D-Novel4DCT Toolbox  ("Novel4DCT-Toolbox")
    %   DH Thomas, Ph.D
    %   University of California, Los Angeles
    %   Contact: mailto:dhthomas@mednet.ucla.edu
    %------------------------------------------------------------------------
    % $Author: DHThomas $	$Date: 2014/04/01 10:23:59 $	$Revision: 0.1 $

    scan = patient.ref;
registration_folder = [patient.folder_elastix sprintf('/out_phase%d_phase%d', patient.ref, scan)];
temp = import_transformparams([registration_folder '/TransformParameters.0.txt']);

%  transform_params = temp(1);
 transform_params{1,:} = '(Transform "DeformationFieldTransform")';
transform_params{2,:} = '(NumberOfParameters 0)';

dvf_filename = [scan_folder sprintf('/deformationField.mhd')];
transform_params{3,:} = sprintf('(DeformationFieldFileName "%s")',dvf_filename);
transform_params{4,:} = '(DeformationFieldInterpolationOrder 1)';

for p = 5:30;
    transform_params{p,:} = temp{p+1,:};
end

transform_params{26,:} = '(FinalBSplineInterpolationOrder 0)';
% transform_params{28,:} = '(ResampleInterpolator "FinalBSplineInterpolator")';
% transform_params{29,:} = '(FinalBSplineInterpolationOrder 0)';

file_name = [scan_folder '/Model_TransformParameters_mask.0.txt']
csvwrite_dt(file_name,transform_params)
end